-- @Author: 作者QQ381990860
-- @Date:   2022-04-15 16:02:36
-- @Last Modified by:   作者QQ381990860
-- @Last Modified time: 2022-07-23 06:56:39




local 场景类_成就 = class(窗口逻辑)
local insert = table.insert
local remove = table.remove
local floor = math.floor
local bwh = require("gge包围盒")
local bw = bwh(0,0,27,87)
local bw1 = bwh(0,0,157,31)
local tp,zts,zts10
local mousea = 引擎.鼠标弹起
local box = 引擎.画矩形
function 场景类_成就:初始化(根)
    self.ID = 315
    self.x = 90+(全局游戏宽度-800)/2
    self.y = 65
    self.xx = 0
    self.yy = 0
    self.注释 = "成就"
    tp = 根
        self.鼠标 = false
    self.焦点 = false
    self.可移动 = true
    local 按钮 = 根._按钮
    local 自适应 = 根._自适应
    local  资源= 根.资源
    self.资源组 = {
        [1] = 根.资源:载入("成就背景.png","加密图片"),
        [3] = 按钮.创建(根.资源:载入('MAX.7z',"网易WDF动画",2),0,0,3),
        [4] =  按钮.创建(资源:载入('MAX.7z',"网易WDF动画",1),0,0,4,true,true,"我的成就"),
        [5] =  按钮.创建(资源:载入('MAX.7z',"网易WDF动画",1),0,0,4,true,true,"梦幻游记"),
         [6] =按钮.创建(资源:载入('MAX.7z',"网易WDF动画",0),0,0,4,true,true," 彩饰盒"),
         [7] =按钮.创建(资源:载入('MAX.7z',"网易WDF动画",0),0,0,4,true,true,"个人空间"),
         [8] =按钮.创建(资源:载入('MAX.7z',"网易WDF动画",0),0,0,4,true,true,"成就设置"),
         [9] =按钮.创建(资源:载入('MAX.7z',"网易WDF动画",0),0,0,4,true,true,"账户安全"),
          [10] =资源:载入('uisc.wdf',"网易WDF动画",0x00000029),
          [11] =按钮.创建(资源:载入('uisc.wdf',"网易WDF动画",0x00000027),0,0,4,true,true,"上页"),
          [12] =按钮.创建(资源:载入('uisc.wdf',"网易WDF动画",0x00000027),0,0,4,true,true,"下页"),
          [13] =按钮.创建(资源:载入('uisc.wdf',"网易WDF动画",0x00000027),0,0,4,true,true,"领奖"),
          --[14] =按钮.创建(资源:载入('uisc.wdf',"网易WDF动画",0x00000027),0,0,4,true,true,"无用"),
           [15] =资源:载入('uisc.wdf',"网易WDF动画",0x00000026), --桃子
            [16] =资源:载入('uisc.wdf',"网易WDF动画",0x00000028), --完成
    }
self.丰富文本=根._丰富文本(214,235)
self.资源组[3]:绑定窗口_(315)
    for i=4,5 do
        self.资源组[i]:绑定窗口_(315)
        self.资源组[i]:置偏移(35,2)
    end
        for n=6,9 do
                self.资源组[n]:绑定窗口_(315)
            self.资源组[n]:置偏移(0,-1)
        end
        local wz = require("gge文字类")
    zts10=wz.创建(程序目录.."Data/pic/hkyt_w5.ttf",14,false,false,true)
    zts11=wz.创建(程序目录.."Data/pic/hkyt_w5.ttf",15,false,false,true)
    zts11:置颜色(0XFFFFFFFF)
    zts12=wz.创建(程序目录.."Data/pic/hkyt_w5.ttf",14,false,false,true)
    zts12:置颜色(0XFF000000)
    self.翻页 =false
    self.窗口时间 = 0
        self.成就={}
        self.成就1={}
zts = tp.字体表.普通字体
self.状态 = 1
self.加入=0
self.类型=1
end




function 场景类_成就:打开(内容)
  if self.可视 then

        self.可视 = false
self.成就={}
self.成就1={}
self.加入=0
self.类型=1
self.丰富文本:清空()
  else
   self.资源组[2]=tp.资源:载入(tp.场景.人物.数据.造型.."头像.png","加密图片")
   self.丰富文本:添加文本("#Y/当总成就积分达到#r/10、#r/20、#r/50、#r/100、#r/200#Y/时可以获得对应属性加成。#r/气血#g/+400#r/、伤害#g/+80、 #r/灵力#g/+60、#r/躲闪#g/+80、#r/命中#g/+250、#r/防御#g/+120、#r/法防#g/+80、#r/速度#g/+80，#r/魔法上限#g/+400，#Y/2级属性为#r/2#Y/倍，#Y/3级为#r/3#Y/倍，#Y/4级为#r/4#Y/倍，#Y/5级为#r/6#Y/倍")
        if  self.x > 全局游戏宽度 then
        self.x = 82+(全局游戏宽度-800)/2
        end
        insert(tp.窗口_,self)
        self.数据=内容
        tp.运行时间 = tp.运行时间 + 1
        self.窗口时间 = tp.运行时间
        self.可视 = true
        for n=1,#cjxt do
        self.成就[#self.成就+1]={介绍=cjxt[n].介绍,次数=cjxt[n].次数,参数 =cjxt[n].参数,奖励 =cjxt[n].奖励介绍}
        end
        for n =1,#self.成就,5 do
        self.成就1[#self.成就1+1] = self.成就[n].参数
        end
  end
 end
function 场景类_成就:显示(dt,x,y)
    self.焦点 = false
    if  self.状态 == 2 then
    self.资源组[1]:显示(self.x-1,self.y-2)
    else
    self.资源组[1]:显示(self.x,self.y)
    end
    for i=3,9 do
       self.资源组[i]:更新(x,y)
    end
        for n=1,2 do
     bw:置坐标(self.x+614,self.y+71+(n-1)*90)
            local xz = bw:检查点(x,y)
                if xz then
                if mousea(0) then
                self.状态 = n
                if self.状态 == 1 then
        self.资源组[1] = tp.资源:载入("成就背景.png","加密图片")
                else
        self.资源组[1] = tp.资源:载入('uisc.wdf',"网易WDF动画",0x00000025)
                end
                end
                end
    self.资源组[3]:显示(self.x+585,self.y+3,true,1)
    if self.状态 == 1 then
    self.资源组[2]:显示(self.x+75,self.y+75)
    self.资源组[4]:显示(self.x+316,self.y+50,true,1)
    self.资源组[5]:显示(self.x+460,self.y+50,true,1)
    self.资源组[6]:显示(self.x+126,self.y+435,true,1)
    self.资源组[7]:显示(self.x+228,self.y+435,true,1)
    self.资源组[8]:显示(self.x+370,self.y+435,true,1)
    self.资源组[9]:显示(self.x+507,self.y+435,true,1)
    self.资源组[10]:显示(self.x+380,self.y+249)
    zts:显示(self.x+338,self.y+83,self.数据.总积分)
    zts:显示(self.x+579,self.y+83,"200")
    self.丰富文本:显示(self.x+347,self.y+188)
    elseif self.状态 == 2 then
     self.资源组[11]:更新(x,y,self.加入 > 0)
     self.资源组[12]:更新(x,y,self.加入+11 < #self.成就1)
     self.资源组[13]:更新(x,y)
     self.资源组[11]:显示(self.x+15,self.y+30,true,1)
     self.资源组[12]:显示(self.x+60,self.y+30,true,1)
     self.资源组[13]:显示(self.x+105,self.y+30,true,1)
--     self.资源组[14]:显示(self.x+150,self.y+30,true,1)
     zts10:置颜色(0XFF000000)
    if  self.资源组[11]:事件判断() then
        self.加入= self.加入-11
    elseif  self.资源组[12]:事件判断() then -- +
         self.加入= self.加入+11
          elseif  self.资源组[13]:事件判断() then -- +
       客户端:发送数据(1,41,5,1,1)
    end


     local xxx = 0
     for n=1,#self.成就1 do
     if n <= self.加入 + 11 and n > self.加入 then
     bw1:置坐标(self.x-1+44,self.y+60-2+34*xxx)
            local xz = bw1:检查点(x,y)
                if xz then
                if mousea(0) then
                self.类型=n
                end
                end
     zts10:显示(self.x-1+44,self.y+69-2+34*xxx,self.成就1[n])
     xxx = xxx + 1
     end
     end
     local yyy = 0
     for n=1,#self.成就 do
     if yyy < 5 then
     if self.成就[n].参数 == self.成就1[self.类型] then
     zts11:显示(self.x+294,self.y+71+80*yyy,self.成就[n].介绍)
     zts12:显示(self.x+294,self.y+100+80*yyy,self.成就[n].奖励)
 if self.数据[self.成就[n].参数].次数 < self.成就[n].次数 then
zts12:置颜色(0xFFFF3030):显示(self.x+294,self.y+117+80*yyy,"未完成：当前完成次数为"..self.数据[self.成就[n].参数].次数.."/"..self.成就[n].次数)
else
zts12:置颜色(0xFF00CD00):显示(self.x+294,self.y+117+80*yyy,"已完成")
self.资源组[16]:显示(self.x+480,self.y+80+80*yyy)
end
zts12:置颜色(0xFF000000)
     yyy = yyy + 1
     end
     end
end







    end
end
end




return 场景类_成就



